﻿using CPPEI.WebApi;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CMS.WebApi.article
{
    [AuthPostAction("article", "disable", "1.0")]
    public class DisableAction : BaseAction<DisableParams, DisableResult>
    {
        protected override ActionResult<DisableResult> OnExecute(ActionContext context, SysParams sysParams, DisableParams opParams)
        {
            CMS.Domain.Services.DisableService service = new Domain.Services.DisableService();
            CPPEI.ServiceResult serResult = service.DisableArticle(opParams.Id);

            if(serResult.IsSuccess)
            {
                DisableResult actResult = new DisableResult();
                return new ActionResult<DisableResult>(actResult);
            }
            else
            {
                return new ActionResult<DisableResult>(serResult);
            }
        }
    }

    public class DisableParams
    {
        public Guid Id { get; set; }
    }

    public class DisableResult
    {
    }
}
